package models;

import com.avaje.ebean.Model;

import javax.persistence.*;

/**
 * UserPermissionManytomany entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "user_permission_manytomany")
public class UserPermissionManytomany extends Model{

	// Fields
	@EmbeddedId
	@AttributeOverrides({
			@AttributeOverride(name = "userId", column = @Column(name = "user_id", nullable = false)),
			@AttributeOverride(name = "permissionId", column = @Column(name = "permission_id", nullable = false)) })
	public UserPermissionManytomanyId id;

    @ManyToOne(cascade = CascadeType.ALL,fetch = FetchType.LAZY)
    @JoinColumn(name = "user_id", referencedColumnName = "user_id", nullable = false, insertable = false, updatable = false)
	public User user;

    @ManyToOne(cascade = CascadeType.ALL,fetch = FetchType.LAZY)
    @JoinColumn(name = "permission_id", referencedColumnName = "permission_id", nullable = false, insertable = false, updatable = false)
	public Permission permission;

    public static Model.Finder<Long, UserPermissionManytomany> find = new Model.Finder<>(UserPermissionManytomany.class);

}